home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Pascal / Applications / Flight Stability / Flight Stability Source / CFSHelpDirector.p < prev    next >
Encoding:
Text File  |  1995-07-11  |  5.7 KB  |  121 lines  |  [TEXT/PJMM]

  1. {****************************************************}
  2. {}
  3. {        CFSHelpDirector.p                                                                                                                                                                                        }
  4. {}
  5. {        Director methods for the help window.                                                                                                                            }
  6. {}
  7. {        Copyright © 1995, Patrick Hew.  All rights reserved.                                                                            }
  8. {}
  9. {****************************************************}
  10.  
  11.  
  12. unit CFSHelpDirector;
  13.  
  14. interface
  15.  
  16.     uses
  17.         TCL, FSIntf;
  18.  
  19. implementation
  20.  
  21.     const
  22.  
  23.     { Dimensions. }
  24.  
  25.         kEdgeMargin = 4;
  26.  
  27.         kNumButtons = 4;
  28.         kButtonLenh = (kFSHelpWindh - kEdgeMargin) div kNumButtons - kEdgeMargin;
  29.         kButtonLenv = 20;
  30.  
  31.         kAboutPosh = kEdgeMargin;
  32.         kFlyingPosh = kAboutPosh + kButtonLenh + kEdgeMargin;
  33.         kStabilityPosh = kFlyingPosh + kButtonLenh + kEdgeMargin;
  34.         kDrawingPosh = kStabilityPosh + kButtonLenh + kEdgeMargin;
  35.         kButtonsPosv = kFSHelpWindv - kEdgeMargin - kButtonLenv;
  36.  
  37.         kPictureLenh = kFSHelpWindh; { 318 }
  38.         kPictureLenv = kButtonsPosv - kEdgeMargin; { 434 -4-20-4 = 406 }
  39.  
  40.  
  41. { IFSHelpDirector }
  42. {}
  43. { Post: Our help director has been initialized. }
  44.  
  45.     procedure CFSHelpDirector.IFSHelpDirector (aSupervisor: CDirectorOwner);
  46.  
  47.     begin { IFSHelpDirector }
  48.         IDirector(aSupervisor);
  49.  
  50.         itsPicture := nil;
  51.  
  52.         itsCreditsButton := nil;
  53.         itsFlyingButton := nil;
  54.         itsStabilityButton := nil;
  55.         itsDrawingButton := nil;
  56.  
  57. { itsMode is initialized in BuildWindow. }
  58.  
  59.     end; { IFSHelpDirector }
  60.  
  61.  
  62. { Free }
  63. {}
  64. { Post: Our help director has been disposed of. }
  65.  
  66.     procedure CFSHelpDirector.Free;
  67.  
  68.     begin { Free }
  69.         itsPicture := nil;
  70.  
  71.         itsCreditsButton := nil;
  72.         itsFlyingButton := nil;
  73.         itsStabilityButton := nil;
  74.         itsDrawingButton := nil;
  75.  
  76.         inherited Free;
  77.     end; { Free }
  78.  
  79.  
  80. { BuildWindow }
  81. {}
  82. { Post: The floating window which the help director supervises has been built. }
  83.  
  84.     procedure CFSHelpDirector.BuildWindow;
  85.  
  86.         var
  87.             theWindow: CWindow;
  88.             thePicture: CPicture;
  89.             theButton: CButton;
  90.  
  91.     begin { BuildWindow }
  92.         { The help window is a floating one. }
  93.         new(theWindow);
  94.         theWindow.IWindow(WINDHelp, TRUE, gDesktop, SELF);
  95.         itsWindow := theWindow;
  96.  
  97.         { We don't want to have to select the window before having it act. }
  98.         itsWindow.SetActClick(TRUE);
  99.  
  100.         { The window is initially hidden, set by the resource. }
  101.         { We don't use the decorator, because it CenterWindow puts the window at the }
  102.         { centre of the desktop, when what we want is to centre the game and help }
  103.         { windows on the primary screen. }
  104.         { Align to of help window to top of game window. }
  105.         theWindow.Move((screenBits.bounds.right - screenBits.bounds.left + kFSGameWindh - kFSHelpWindh) div 2, (screenBits.bounds.bottom - screenBits.bounds.top - kFSGameWindv) div 2 + 20);
  106.  
  107.         { The picture pane, in which everything appears. }
  108.  
  109.         new(thePicture);
  110.         thePicture.IPicture(itsWindow, SELF, kPictureLenh, kPictureLenv, 0, 0, sizFIXEDSTICKY, sizFIXEDSTICKY);
  111.         itsPicture := thePicture;
  112.  
  113.         { Topic buttons. }
  114.  
  115.         new(theButton);
  116.         theButton.INewButton(kButtonLenh, kButtonLenv, kAboutPosh, kButtonsPosv, 'Credits', kVisible, 0, itsWindow, SELF);
  117.         theButton.SetClickCmd(cmdModeCredits);
  118.         itsCreditsButton := theButton;
  119.  
  120.         new(theButton);
  121.